Invoke an action that is using ASP.NET MVC [Authorize] from outside the application

Posted by Nate Bross on Stack Overflow See other posts from Stack Overflow or by Nate Bross
Published on 2010-03-30T18:32:39Z Indexed on 2010/03/30 18:33 UTC
Read the original article Hit count: 333

Is this possible?

I'd like to expose a URL (action) such as http://mysever/myapp/UpdateHeartbeat/.

In my MVC application it looks like

[Authorize]
[AcceptsVerbs(HttpVerbs.Post)]
public ActionResult UpdateHeartbeat()
{
    // update date in DB to DateTime.Now
}

Now, in my MVC application the user has logged in via FORMS authentication and they can execute that action to their hearts content.

What I want to do, is hit that URL progromatically (as part of an API that I wouldl like to build) -- is there a way I can do that without removing the [Authorize] attribute and adding username/password as parameters to the POST?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about ASP.NET